package com.lenovo.spider.process.parser;

import com.lenovo.spider.process.TaskProcess;
import com.lenovo.spider.domain.SiteConfig;
import com.lenovo.spider.domain.Task;
import lombok.extern.slf4j.Slf4j;


/**
 * @author <a href="mailto:liuhan3@lenovo.com">HanL(liuhan3)</a>
 * on 2018/3/21 17:46
 */
@Slf4j
public abstract class PageParser implements TaskProcess {

    public Task parser(Task task) {
        return doIf(Task::isSuccess, this::doParser).apply(task);
    }

    public abstract SiteConfig getSiteConfig();

    protected abstract Task doParser(Task task);
}
